package com.bodu.exchange.service.impl;

import com.bodu.exchange.entity.vo.ExchangeIconVo;
import com.bodu.core.entity.ParamReq;
import com.bodu.exchange.entity.request.ExchangeIconRequest;
import com.bodu.exchange.mapper.ExchangeIconMapper;
import com.bodu.exchange.service.ExchangeIconService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
* 账单图标 Service impl
* @author Administrator
*/
@Service
public class ExchangeIconServiceImpl implements ExchangeIconService {

   @Resource
   private ExchangeIconMapper exchangeIconMapper;

   @Override
   public ExchangeIconVo getModel(Long id) {
      return  exchangeIconMapper.getModel(id);
   }

   @Transactional
   @Override
   public Long save(ExchangeIconRequest request) {
      exchangeIconMapper.save(request);
      return request.getId();
   }

   @Transactional
   @Override
   public Long update(ExchangeIconRequest exchangeIconRequest) {
      exchangeIconMapper.update(exchangeIconRequest);
      return exchangeIconRequest.getId();
   }

   @Override
   public List<ExchangeIconVo> listPage(ParamReq<ExchangeIconRequest> params) {
      params.setStartIndex((params.getCurrent() -1 ) * params.getSize());
      return exchangeIconMapper.listPage(params);
   }

   @Override
   public Integer countPage(ParamReq<ExchangeIconRequest> params) {
       return exchangeIconMapper.countPage(params);
   }

   @Override
   public Integer updateDelFlagById(Long id, Integer delFlag) {
       return exchangeIconMapper.updateDelFlagById(id, delFlag);
   }
}
